package com.shoulei.designpattern.ProxyPattern;

/**
 * @ClassName:ProxyImage
 * @Descrition:
 * @Author:shoulei
 * @Date:2019/4/14 16:02
 * @Verson:
 */
public class ProxyImage implements Image{
    private String fileName;
    private RealImage realImage;

    public ProxyImage(String fileName) {
        this.fileName = fileName;
    }

    @Override
    public void display() {
        if(realImage == null){
            realImage = new RealImage(fileName);
        }
        realImage.display();
    }
}
